// 服务器监控路由
import { Router } from 'express';
import serverController from '@/controllers/monitor/server.controller';
import { authMiddleware, optionalAuthMiddleware } from '@/middlewares/auth.middleware';
import { permissionMiddleware } from '@/middlewares/permission.middleware';

const router = Router();

/**
 * 服务器监控路由
 * 路径前缀：/monitor/server
 */

// ================== 服务器监控相关 ==================
// 基本监控信息可以不需要认证
router.get('/', optionalAuthMiddleware, serverController.getServerMonitor);

// 以下路由需要认证
router.use(authMiddleware);

// 获取服务器基本信息
router.get('/info', permissionMiddleware('monitor:server:list'), serverController.getServerInfo);

// 测试告警发送
router.post('/alert/test', permissionMiddleware('monitor:server:list'), serverController.testAlert);

export default router;